<script setup>
import CommonAside from '@/components/CommonAside.vue';
import CommonHeader from '@/components/CommonHeader.vue';
import CommonTab from '@/components/CommonTab.vue';
import { useRoute } from 'vue-router';

const route = useRoute();
</script>

<template>
    <div class="common-layout">
        <el-container class="lay-container">
            <!-- 自定义左侧的组件 -->
            <common-aside />
            <el-container>
                <el-header class="el-header">
                    <common-header />
                </el-header>
                <common-tab />
                <el-main class="right-main">
                    <router-view v-slot="{ Component }">
                        <keep-alive :include="['Home', 'StoreCashier', 'Settlement', 'Inventory', 'InventoryTransaction']">
                            <component :is="Component" :key="route.path" />
                        </keep-alive>
                    </router-view>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<style scoped lang="less">
.common-layout,
.lay-container {
    height: 100%;
    overflow: hidden;
}

.el-header {
    background-color: #333;
}

.right-main {
    padding: 20px;
    background-color: #f5f7fa;
    height: calc(100vh - 120px);
    overflow: auto;
}
</style>
